Skip to content

Conversation

@guan404ming
Copy link
Member

@guan404ming guan404ming commented Sep 23, 2025

Related

#51667

Why

  • Chart.js tooltips don't match the application's design system
  • Default tooltips can't adapt to light/dark mode properly
  • Chart.js tooltips get squeezed/truncated when there's insufficient height, while custom tooltips maintain full
    content visibility

How

  • Created GanttTooltip.tsx using Chakra UI components
  • Disabled Chart.js default tooltip, positioned custom tooltip with React state
Screen.Recording.2025-09-23.at.10.41.13.PM.mov

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Sep 23, 2025
@bbovenzi bbovenzi added this to the Airflow 3.1.0 milestone Sep 23, 2025
@bbovenzi
Copy link
Contributor

bbovenzi commented Sep 23, 2025

I am starting to feel like relying on chartjs for the gantt chart is causing too many headaches. I wonder if it would be better to just rip it all out.

But that might have to be for 3.2

if (hoveredData?.taskId !== undefined) {
setTooltipData({
taskId: hoveredData.taskId,
visible: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need visible or can we just check that taskId, x, y exist?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems redundant. I've removed it.

data={data}
selectedTimezone={selectedTimezone}
taskId={tooltipData.taskId}
translate={translate}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we passing translate instead of calling useTranslate inside of GanttTooltip?

Copy link
Member Author

@guan404ming guan404ming Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try to make it more efficient without initializing it again. But it would be more straightforward to call it inside the component. I've updated it.

Comment on lines 48 to 55
const [lightBg, darkBg, lightBorder, darkBorder, lightText, darkText] = useToken("colors", [
"white",
"gray.800",
"gray.200",
"gray.600",
"gray.800",
"white",
]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the semantic token colors directly in <Box />. We only need useToken when we need to pass the actual hex code to a non chakra component.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Colors don't match our existing tooltips either.

Screenshot 2025-09-23 at 11 30 37 AM

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. I've reversed the style between dark and light.

@bbovenzi
Copy link
Contributor

I haven't looked too deeply, but the hover interaction feels slower. I wonder if the state change is forcing extra rendering

@bbovenzi bbovenzi removed this from the Airflow 3.1.0 milestone Sep 23, 2025
@guan404ming
Copy link
Member Author

guan404ming commented Sep 23, 2025

I am starting to feel like relying on chartjs for the gantt chart is causing too many headaches. I wonder if it would be better to just rip it all out.

I agree, I also think it might be better to slowly move away from Chart.js. We can take it step by step, maybe target 3.2 or 3.1.x.

I haven't looked too deeply, but the hover interaction feels slower. I wonder if the state change is forcing extra rendering

yes, the hover feels noticeably slower. Probably because extra re-rendering like you said. This part is kind of tricky since we don’t have direct control over the bar element (it is also a headache part), so i think it’ll take some testing and improvement to smooth things out.

@bbovenzi
Copy link
Contributor

Let's save this change for when we try to remove chartjs from the gantt chart entirely instead of trying to hack something together.

@guan404ming guan404ming marked this pull request as draft September 23, 2025 22:55
@guan404ming
Copy link
Member Author

Close this one for now since rewrite the chart seems like a better option for this issue but could re-open if needed in the future.

@guan404ming guan404ming closed this Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants